﻿Imports System
Imports System.Data
Imports System.Data.OleDb

Public Class Job
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim strJobId As String = Request.QueryString("jobId")
        'Assume that access_db/Jobs.mdb exists in the root of hosting directory
        'Dim strDataSource As String = Server.MapPath("/access_db/Jobs.mdb")

        'Assume that access_db/Jobs.mdb exists in the current directory
        Dim strDataSource As String = Server.MapPath("db/Jobs.mdb")

        'Assume that access_db/Jobs.mdb exists in the parent directory of C: drive
        'Dim strDataSource As String = Server.MapPath("../access_db/Jobs.mdb")

        Dim strConnection1 As String = "Provider=Microsoft.Jet.OleDb.4.0;" & _
                                        "Data source=" & strDataSource
        Dim objConnection1 As New OleDbConnection(strConnection1)

        Dim strSQL As String = ""
        strSQL = "SELECT * FROM tblJobs WHERE jobId = " & Val(strJobId)
        'MsgBox(strSQL)

        Try
            objConnection1.Open()
            Dim objCommand As New OleDbCommand(strSQL, objConnection1)
            Dim objReader As OleDbDataReader
            objReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
            While objReader.Read()

                lblJobId.Text = objReader.Item("jobId").ToString
                'If StrComp(objReader.Item("jobSpecTitle"), "") = 0 Then
                'lblTitle.Text = Trim(objReader.Item("jobTitle"))
                'Else
                lblTitle.Text = Trim(objReader.Item("jobSpecTitle"))
                'End If
                lblIndustry.Text = Trim(objReader.Item("jobIndustry"))
                lblCity.Text = Trim(objReader.Item("jobCity"))
                lblDate.Text = Trim(objReader.Item("jobDate"))
                lblStatus.Text = Trim(objReader.Item("jobStatus"))
                lblPayRate.Text = Trim(objReader.Item("jobPayRate"))
                txtDescription.Text = Trim(objReader.Item("jobDescription"))
            End While
            objReader.Close()
            objConnection1.Close()
            objConnection1.Dispose()

        Catch ex As Exception
            Response.Write("Error: " & ex.Message)
        End Try
    End Sub

End Class
